<template>
  <div class="app">
    <!-- 
        消息订阅与发布(pubsub)
          1.一种组件间通信的方式,适用于任意组件通信

          2.使用步骤:
            a.安装pubsub: cnpm install pubsub-js

            b.引入: import pubsub from 'pubsub-js'

            c.接收数据: A组件想接收数据,则在A组件中订阅消息,订阅消息的回调留在A中

              methods:{
                demo (msgName, data) {
                  ...
                }
              }

              mounted () {
                pubsub.scribe('xxx', this.demo)
              }
            
            d.提供数据: pubsub.publish('xxx',数据)

            e.最好在beforeDestory钩子中,用Pubsbub.unsubscribe(pid)取消订阅
            
     -->


    <school ></school>
    <hr>
    <student></student>
  </div>
</template>

<script>
    //引入组件
    import student from './components/student.vue'
    import school from './components/school.vue'
    export default {
      name: 'App',
      data () {
        return {
          msg: '欢迎学习vue',
          studentName: ''
        }
      },
      components: {
        student,
        school
      },
      methods: {

      }
    }
</script>

<style>
  .app {
    background: grey;
    padding: 5px;
  }
</style>